// 2023-03-09 11:04:20
import BaseModel from "../baseModel.js";

class PetModel extends BaseModel {
    /**
     * 
     * @param {PetModel} model 
     */
    constructor(model) {
        super(model);
        /* 自定义属性以及重载 */
        this.petName = PetModel.CheackNull(model.petName);
        this.gender = !isNaN(parseInt(model.gender)) ? parseInt(model.gender) : 2;
        this.age = model.age; // 年龄
        this.introduction = model.introduction;
        this.ownerID = PetModel.CheackNull(model.ownerID); // 主人id 
        this.breedID = model.breedID; // 品种
        this.portraitSrc = model.portraitSrc; // 宠物头像
        this.isDewormed = !isNaN(parseInt(model.isDewormed)) ? parseInt(model.isDewormed) : 2;
        this.isNeutered = !isNaN(parseInt(model.isNeutered)) ? parseInt(model.isNeutered) : 2;
        this.type = PetModel.CheackBoolean(model.type); // 0:猫；1：狗
    }
    static Instance = 'pet' // 表名
}
export default PetModel;